//
//  GDButtonView.m
//  Gunterapple
//
//  Created by 热带雨林 on 2021/2/1.
//  Copyright © 2021 热带雨林. All rights reserved.
//

#import "GDButtonView.h"

@interface GDButtonView ()
@property (nonatomic, strong) UIView *leftViwe;
@property (nonatomic, strong) UIView *rightView;
@property (nonatomic, strong) UIStackView *stackView;
@end

@implementation GDButtonView

- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI{
    
    self.leftViwe = [[UIView alloc]initWithFrame:CGRectZero];
    self.leftViwe.layer.cornerRadius = 10.0f;
    self.leftViwe.layer.masksToBounds = YES;
    self.leftViwe.backgroundColor = [UIColor redColor];
    
    self.rightView = [[UIView alloc]initWithFrame:CGRectZero];
    self.rightView.layer.cornerRadius = 10.0f;
    self.rightView.layer.masksToBounds = YES;
    self.rightView.backgroundColor = [UIColor blueColor];
    
    self.stackView = [[UIStackView alloc]initWithArrangedSubviews:@[self.leftViwe,self.rightView]];
    [self addSubview:self.stackView];
    self.stackView.spacing = 5.0f;
    self.stackView.axis = UILayoutConstraintAxisHorizontal;
    self.stackView.distribution = UIStackViewDistributionFillEqually;
    self.stackView.alignment = UIStackViewAlignmentFill;
    UIEdgeInsets padding = UIEdgeInsetsMake(3, 3, 3, 3);
    [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self).insets(padding);
    }];
}
@end
